#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>

int main()
{
    int fd=open("log.txt",O_RDONLY);
    dup2(fd,0);
    char buff[1024];
    while(1)
    {
        char* s=fgets(buff,sizeof(buff),stdin);
        if(s==NULL) break;
        printf("file contents:%s",buff); 
    }
    
    return 0;
}